import akshare as ak
from utils.time_util import TimeUtils


class StockDataUtil:
    """
        输入股票代码，返回股票数据
    """

    @staticmethod
    def get_stock_data_from_code(code: str = "600519", k: int = 7):
        stock_zh_a_hist_df = ak.stock_zh_a_hist(symbol=code, period="daily", start_date=TimeUtils.before_k_day(k),
                                                end_date=TimeUtils.today())
        return stock_zh_a_hist_df


if __name__ == '__main__':
    print(StockDataUtil.get_stock_data_from_code())
